Justifying the Correctness of the Fibonacci Sequence and the Euclide Algorithm by Loop-Invariant
نویسنده
چکیده
If a loop-invariant exists in a loop program, computing its result by loop-invariant is simpler and easier than computing its result by the inductive method. For this purpose, the article describes the premise and the final computation result of the program such as “while<0”, “while>0”, “while<>0” by loop-invariant. To test the effectiveness of the computation method given in this article, by using loop-invariant of the loop programs mentioned above, we justify the correctness of the following three examples: Summing n integers (used for testing “while>0”), Fibonacci sequence (used for testing “while<0”), Greatest Common Divisor, i.e. Euclide algorithm (used for testing “while<>0”).
منابع مشابه
Justifying the Correctness of the Fibonacci Sequence and the Euclide Algorithm by Loop-Invariant1
If a loop-invariant exists in a loop program, computing its result by loopinvariant is simpler and easier than computing its result by the inductive method. For this purpose, the article describes the premise and the final computation result of the program such as “while<0”, “while>0”, “while<>0” by loop-invariant. To test the effectiveness of the computation method given in this article, by us...
متن کاملRanking of Fire Stations with Fibonacci Sequence Technique, Case Study: District Ten of Tehran Municipality
One of the effective items to reduce time for arriving fire fighters to place of event is determining the optimal location of fire stations. Ranking can define the best location of a fire station through the available options. The case of this study is the district ten of Tehran municipality. That is the smallest district of Tehran municipality in terms of size and is highest in terms of densit...
متن کاملA Generalized Fibonacci Sequence and the Diophantine Equations $x^2pm kxy-y^2pm x=0$
In this paper some properties of a generalization of Fibonacci sequence are investigated. Then we solve the Diophantine equations $x^2pmkxy-y^2pm x=0$, where $k$ is positive integer, and describe the structure of solutions.
متن کاملA Class of Convergent Series with Golden Ratio Based on Fibonacci Sequence
In this article, a class of convergent series based on Fibonacci sequence is introduced for which there is a golden ratio (i.e. $frac{1+sqrt 5}{2}),$ with respect to convergence analysis. A class of sequences are at first built using two consecutive numbers of Fibonacci sequence and, therefore, new sequences have been used in order to introduce a new class of series. All properties of the se...
متن کاملToeplitz transforms of Fibonacci sequences
We introduce a matricial Toeplitz transform and prove that the Toeplitz transform of a second order recurrence sequence is another second order recurrence sequence. We investigate the injectivity of this transform and show how this distinguishes the Fibonacci sequence among other recurrence sequences. We then obtain new Fibonacci identities as an application of our transform.
متن کامل